package com.example.demo.model;

import com.example.demo.enums.ResultStatus;
import lombok.Data;

@Data
public class Result <T>{
    private ResultStatus code;
    private String ErrMsg;
    private T data;

    public static <T> Result<T> success(T data){
        Result<T> result=new Result<>();
        result.setCode(ResultStatus.SUCCESS);
        result.setData(data);
        result.setErrMsg("");
        return result;
    }
    public static <T> Result<T> fail(String msg){
        Result<T> result=new Result<>();
        result.setCode(ResultStatus.FAIL);
        result.setErrMsg(msg);
        return result;
    }
}
